import App from './App'
import pinia from './store'

// 全局错误处理
const handleError = (err) => {
  console.error('应用错误:', err)
}

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
Vue.config.errorHandler = handleError
App.mpType = 'app'
const app = new Vue({
  ...App,
  pinia
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  app.use(pinia)
  app.config.errorHandler = handleError
  return {
    app
  }
}
// #endif